<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head :: head"></head>
<body class="gray-bg">
<form id="ec" action="/userInfo" method="post">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <table class="table form-table margin-bottom10">
                            <tr>
                                <td>
                                    <input type="text" name="mobile" value="" placeholder="手机号码" class="input-sm form-control"/>
                                </td>
                            </tr>
                        </table>
                        <div>
                            <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                            <button type="button" id="loading-example-btn" onclick="javascript:window.location.reload();" class="btn btn-white btn-sm">刷新</button>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>昵称</th>
                                <th>手机号码</th>
                                <th>状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr class="gradeX" th:each="userInfo,it : ${page.list}">
                                <td class="text-center" th:text="${it.count}">11</td>
                                <td th:text="${userInfo.nickName}">22</td>
                                <td th:text="${userInfo.phone}">33</td>
                                <td>
                                    <strong><span th:if="${userInfo.status} eq 1">正常</span></strong>
                                    <strong><span th:if="${userInfo.status} eq 0">锁定</span></strong>
                                </td>
                                <td th:text="${#dates.format(userInfo.createTime,'yyyy-MM-dd HH:mm:ss')}" >33</td>
                                <td class="text-center">
                                    <a class="lock" th:attr="data-id=${userInfo.id},data-status=0" th:if="${userInfo.status} eq 1">锁定</a>
                                    <a class="lock" th:attr="data-id=${userInfo.id},data-status=1" th:if="${userInfo.status} eq 0">解锁</a>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <div class="row" th:include="common/pagination :: pagination"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    $(function(){
        $(".lock").on("click",function () {
            var id = $(this).attr("data-id");
            var status = $(this).attr("data-status");
            opt.confirm("/userInfo/lock/" + id + "/" + status, "确定该操作吗？");
        });
    });
</script>
</body>
</html>
